package Java练习.面向对象综合练习.代码块;

import jdk.dynalink.beans.StaticClass;

public class 静态代码块 {
    private String name;
    private int age;

    //执行时机:随着类的加载而加载,并且只执行一次.
    static {
        System.out.println("静态代码块执行了");
    }

    public 静态代码块() {
    }

    public 静态代码块(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}
